package com.yuhuofei2021.spring.boot.weather.controller;

import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yuhuofei2021.spring.boot.weather.entity.WeatherResponse;
import com.yuhuofei2021.spring.boot.weather.service.WeatherDataService;

/**
 * @description Weather 控制器
 * @author yuhuofei2021
 * @date 2021年7月1日
 */
@RestController
@RequestMapping("/weather")
public class WeatherController {

	@Resource
	private WeatherDataService weatherDataService;
	
	@PostMapping("/cityId")
	public WeatherResponse getDataByCityId(@RequestParam String cityId) {
		return weatherDataService.getDataByCityId(cityId);
	}
	
	@PostMapping("/cityName")
	public WeatherResponse getDataByCityName(@RequestParam String cityName) {
		return weatherDataService.getDataByCityName(cityName);
	}
}
